<?xml version="1.0" encoding="cp1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html 		xmlns="http://www.w3.org/1999/xhtml"
			xmlns:ui="http://java.sun.com/jsf/facelets"
			xmlns:h="http://java.sun.com/jsf/html"
			xmlns:f="http://java.sun.com/jsf/core"
			xmlns:a4j="http://richfaces.org/a4j"
			xmlns:rich="http://richfaces.org/rich"
			xmlns:t="http://myfaces.apache.org/tomahawk">

	<head>
		<title>
			<h:outputText value="#{bundle.tituloAplicacao}" /> 
		</title>
		<link rel="stylesheet" type="text/css" href="/#{bundle.pathAplicacao}/css/geral.css" />
	</head>
	
	<body>

    <a4j:status>
		<f:facet name="start">
		    <div id="divLoading" 
	     		style="filter:alpha(opacity=60, finishopacity=60, style=1);
	            opacity:.3;-moz-opacity:.3;-khtml-opacity:.3;
	            position:fixed;text-align:center;
	            left : 0px; top 0px;
	            width:100%;height:100%;
	            background-color:#F1F1F1;z-index: 999;">
	        </div>
	        <div id="divProcessando" 
		        	style="display: block;background-color:transparent;
		            position:fixed;top:50%;left:50%;
		            width:100px;margin:-62px auto auto -62px;z-index: 4;">
					 <img src="../imagens/loading.gif" border="0"/>
			</div> 
		</f:facet>
	</a4j:status>
  
	
	<div id="conteudoTopo" style="width: 100%; position: fixed; float: top; z-index: 2; background-color: white;">
      
	<table id="subTopo" style="background:url(../imagens/topoFundo.jpg); width: 100%;" cellpadding="0" cellspacing="0" width="100%">
		<tr style="height: 81px;">
			<td style="width: 10px;"></td>
			<td style="width: 320px;">
				<img src="/#{bundle.pathAplicacao}/imagens/logotipoUniodonto.png" border="0"/>
			</td>
			<td class="textoUser" style="width: 500px;">
				Bem vindo, <h:outputText value=" #{loginBean.usuarioVo.nome}" />
			</td>
			<td style="text-align: right; vertical-align: middle;">
				<h:form id="logoutForm">
					<ui:insert name="logout">
						<h:commandButton image="/imagens/logout.png" style="border:white;" title="SAIR" action="#{loginBean.logout}" reRender="formulario, panelTitle"/>
					</ui:insert>
				</h:form>
			</td>
			<td style="width: 10px;"></td>
		</tr>
	</table>    
		<table cellpadding="0" cellspacing="0" width="100%">
			<tr style="background-color: white; height: 15px;">
				<td colspan="3">
					<h:form id="menuForm">
                        <ui:insert name="menu">
                            <ui:include src="menu.xhtml"/>
                        </ui:insert>
                    </h:form>
				</td>
			</tr>
		</table>
		
		</div>
		
		<div id="conteudoPagina" style="width: 100%; position: relative; top: 150px; z-index: 1">
		
		<table width="100%">	
			<tr>
				<td colspan="3">
                   <h:panelGroup id="panelTitle">
                       <t:htmlTag rendered="${pageTitle != null}" value="">
                       <table class="messageTable" width="100%">
                           <tr>
                               <td class="tituloform"> 
                                   <b>#{pageTitle}</b>
                               </td>
                           </tr>
                           <tr>
                               <td class="infotituloform" ><ui:insert name="requiredFieldsMessage" /></td>
                           </tr>
                           <tr>
                             <td>
                               <a4j:outputPanel  ajaxRendered="true">
                                   <h:messages layout="table" warnClass="msgWarm" errorClass="msgError" infoClass="msgInfo" id="messages"/>
                               </a4j:outputPanel>
                             </td>             
                           </tr>
                       </table>
                       </t:htmlTag>
                   </h:panelGroup>
                   <br />
                   <a4j:form id="formulario">
                       <a4j:loadScript src="/script/jquery.maskedinput-1.2.2.js" />
                       <a4j:loadScript src="/script/jquery.price_format.1.2.js" />
                       <a4j:loadScript src="/script/util.js" />
                       <a4j:loadScript src="/script/busca.js" />
					   <a4j:loadScript src="/script/lista.js" />
					   <a4j:loadScript src="/script/ajax.js" />
                       
                       <ui:insert name="saveStateObjects" />
						<ui:insert name="saveStateObjectsDefined" />
                   
                       <ui:insert name="content" />
                       
                       <ui:insert name="buttons">
                           <div id="botao" style="visibility: visible;">
                               <table class="buttonTable" width="100%">
                                   <tr>
                                       <td class="buttonItem">
                                           <ui:insert name="buttonItens"/>
                                       </td>
                                   </tr>
                               </table>
                           </div>
                       </ui:insert>
                       
                       <br/>
                       
                       <ui:insert name="list"/>
                   </a4j:form>
                   
                   <a4j:form id="buscaForm" target="lista">
						<h:inputHidden id="tipoLista" value="#{listaBean.tipoLista}"/>
						<h:inputHidden id="nomeCampoCodigo" value="#{listaBean.nomeCampoCodigo}"/>
						<h:inputHidden id="nomeCampoDescricao" value="#{listaBean.nomeCampoDescricao}"/>
						<h:inputHidden id="nomeFiltro1" value="#{listaBean.nomeFiltro1}"/>
						<h:inputHidden id="valorFiltro1" value="#{listaBean.valorFiltro1}"/>
						<h:inputHidden id="nomeFiltro2" value="#{listaBean.nomeFiltro2}"/>
						<h:inputHidden id="valorFiltro2" value="#{listaBean.valorFiltro2}"/>
		    			<h:commandLink id="pesquisar" action="#{listaBean.preparaPesquisar}" value="">
		    				<f:verbatim></f:verbatim>
		    			</h:commandLink>
					</a4j:form>
				</td>
			</tr>
		</table>
		
		</div>

		
		<script type="text/javascript">
			 //document.getElementById('conteudoPagina').style.height = document.documentElement.clientHeight - 145;
			 //document.getElementById('conteudoPagina').style.overflow = 'auto';
			 //alert(document.getElementById('conteudoPagina').style.height);
			 //alert(document.body.offsetHeight);
			 //alert(document.documentElement.clientHeight);
			 
			 
			
			//inicio script para temporizador de sessao
			var parseSessao;
			
			function beginrefresh()
			{
				if (parseSessao!=0)
				{ 
					parseSessao--;
					curhor=Math.floor((parseSessao/60)/60);
					curmin=Math.floor((parseSessao/60)%60);
					cursec=parseSessao%60;
					if(curhor != 0)
						if(curmin > 9)
							if(cursec > 9)
								curtime="0" + curhor + ":" + curmin + ":" + cursec;
							else
								curtime="0" + curhor + ":" + curmin + ":0" + cursec;
						else
							if(cursec > 9)
								curtime="0" + curhor + ":0" + curmin + ":" + cursec;
							else
								curtime="0" + curhor + ":0" + curmin + ":0" +cursec;
					else 
						if (curmin!=0)
							if(curmin > 9)
								if(cursec > 9)
									curtime= curmin + ":" + cursec;
								else
									curtime= curmin + ":0" +cursec;
							else
								curtime="0" + curmin + ":" + cursec;
						else
							curtime = cursec;
			        
					document.getElementById('temporizadorSessao').innerHTML = ' >> sess�o expira em ' + curtime;
					setTimeout("beginrefresh()",1000);
				}
				else
				{
					//aqui faz o logout
				}
			}
			
			function temporizadorSessaoTomcat()
			{
				parseSessao = ${sessionScope.tempoSessao};
				beginrefresh();
			};
			
			temporizadorSessaoTomcat();
			// fim script para temporizador de sessao

		</script>
		
	</body>
</html>